package com.lxl.config;

import java.text.SimpleDateFormat;
import java.util.Date;

/*
* TYPE字段属于MsgStatus中的字段
* */
public enum ServiceFunction {
    UUID(0), TIME(1);

    private int index;
    private String func;

    private ServiceFunction(int index){
        this.index = index;
        switchFunction(index);
    }

    private void switchFunction(int index){
        switch (index){
            case 0:{
                this.func = java.util.UUID.randomUUID() + "";
                break;
            }
            case 1: {
                this.func = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
                break;
            }
            default:break;
        }
    }

    public int getIndex() {
        return index;
    }

    public String getFunc() {
        switchFunction(index);
        return func;
    }

    public void setFunc(String func) {
        this.func = func;
    }
}
